<template>
  <h1>app</h1>
  <div>
    <h1>{{ count }}</h1>
    <button @click="count++">count++</button>
  </div>

  <div>
    <welCome v-if="isShow" />
    <button @click="isShow = !isShow">创建和卸载welCom页面</button>
  </div>
</template>

<script setup>
import { ref, onMounted, onUpdated } from "vue";
import welCome from "./commponets/welCome.vue";
const isShow = ref(true);
const count = ref(1);

// 生命周期(子先父后):挂载onMounted、更新onUpdated、卸载onUnmounted
// 挂载
onMounted(() => {
  // 应用场景：绑定原生事件、开启定时器、发送ajax请求。。。。
  console.log("app页面挂载成功了");
});
// 更新
onUpdated(() => {
  console.log("app页面更新了");
});
</script>

